<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>{{$title}}</title>
    <link rel="shortcut icon" type="image/ico" href="{{asset('/favicon.ico')}}">
    <meta name="keywords" content="Bootstrap模版,Bootstrap模版下载,Bootstrap教程,Bootstrap中文" />
    <meta name="description" content="JS代码网提供Bootstrap模版,Bootstrap教程,Bootstrap中文翻译等相关Bootstrap插件下载" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    @yield('css')

</head>

<body>
<div class="navbar navbar-default" id="navbar">
    <script type="text/javascript">
        try{ace.settings.check('navbar' , 'fixed')}catch(e){}
    </script>

    <div class="navbar-container" id="navbar-container">
        <div class="navbar-header pull-left">
            <a href="{{url('admin/index')}}" class="navbar-brand">
                <small>
                    <i class="icon-leaf"></i>
                    HHAlpaca 后台管理系统
                </small>
            </a><!-- /.brand -->
        </div><!-- /.navbar-header -->

        <div class="navbar-header pull-right" role="navigation">
            <ul class="nav ace-nav">
                @if(empty(Session::get('admin')['is_author']))
                <li class="green">
                    <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                        <i class="icon-envelope icon-animated-vertical"></i>
                        <span class="badge badge-success">{{\App\Http\Model\Question::where(['is_read'=>0])->count()}}</span>
                    </a>

                    <ul class="pull-right dropdown-navbar dropdown-menu dropdown-caret dropdown-close">
                        <li class="dropdown-header">
                            <i class="icon-envelope-alt"></i>
                            {{\App\Http\Model\Question::where(['is_read'=>0])->count()}}条消息
                        </li>
                        @foreach($Num['7'] as $ds)
                        <li>
                            <a href="#">
                                <img src="
                                @if($ds['avatar']!=null)
                                {{$ds['avatar']}}-40X40
                                @else
                                {{asset('assets/avatars/avatar.png')}}
                                @endif
                                        " class="msg-photo" alt="Alex's Avatar" />
                                <span class="msg-body">
                                    <span class="msg-title">
                                        <span class="blue">
                                            @if($ds['username']!=null)
                                                {{$ds['username']}}
                                                @else
                                                游客
                                                @endif
                                            :</span>
                                        {{mb_substr($ds['question'],0,25,'utf-8')}}..
                                    </span>

                                    <span class="msg-time">
                                        <i class="icon-time"></i>
                                        <span>{{date('Y-m-d H:i:s',$ds['created_at'])}}</span>
                                    </span>
                                </span>
                            </a>
                        </li>
                        @endforeach
                        <li>
                            <a href="{{url('admin/inbox')}}">
                                查看所有消息
                                <i class="icon-arrow-right"></i>
                            </a>
                        </li>
                    </ul>
                </li>
                @endif
                <li class="light-blue">
                    <a data-toggle="dropdown" href="#" class="dropdown-toggle">
                        <img class="nav-user-photo"
                             @if(!empty(Session::get('admin')['avatar']))
                             src="{{Session::get('admin')['avatar']}}"
                             @else
                             src="{{asset('assets/avatars/user.jpg')}}"
                             @endif
                              alt="Jason's Photo" width="36px" height="36px"/>
								<span class="user-info">
									<small>欢迎登录,</small>
                                    {{Session::get('admin')['username']}}
								</span>

                        <i class="icon-caret-down"></i>
                    </a>

                    <ul class="user-menu pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
                        {{--<li>
                            <a href="#">
                                <i class="icon-cog"></i>
                                设置
                            </a>
                        </li>--}}

                        <li>
                            @if(empty(Session::get('admin')['is_author']))
                            <a href="{{url('admin/admininfo')}}">
                                <i class="icon-user"></i>
                                查看更多
                            </a>
                                @elseif(!empty(Session::get('admin')['is_author']))
                                <a href="{{url('admin/authorinfo')}}">
                                    <i class="icon-user"></i>
                                    作者详情
                                </a>
                                @endif
                        </li>

                        <li class="divider"></li>

                        <li>
                            @if(empty(Session::get('admin')['is_author']))
                                <a href="{{url('admin/logout')}}">
                                @else
                                        <a href="{{url('admin/authorlogout')}}">
                                @endif
                                <i class="icon-off"></i>
                                退出
                            </a>
                        </li>
                    </ul>
                </li>
            </ul><!-- /.ace-nav -->
        </div><!-- /.navbar-header -->
    </div><!-- /.container -->
</div>

<div class="main-container" id="main-container">
    <script type="text/javascript">
        try{ace.settings.check('main-container' , 'fixed')}catch(e){}
    </script>

    <div class="main-container-inner">
        <a class="menu-toggler" id="menu-toggler" href="#">
            <span class="menu-text"></span>
        </a>

        <div class="sidebar" id="sidebar">
            <script type="text/javascript">
                try{ace.settings.check('sidebar' , 'fixed')}catch(e){}
            </script>

            <div class="sidebar-shortcuts" id="sidebar-shortcuts">
                <div class="sidebar-shortcuts-large" id="sidebar-shortcuts-large">
                    @if(empty(Session::get('admin')['is_author']))
                    <a href="{{url('admin/imglist/1')}}" class="btn btn-success">
                        <i class="icon-picture"></i>
                    </a>

                    <a href="{{url('admin/artilelist/1')}}" class="btn btn-info">
                        <i class="icon-list"></i>
                    </a>

                    <a href="{{url('admin/userlist')}}" class="btn btn-warning">
                        <i class="icon-group"></i>
                    </a>

                    <a href="{{url('admin/settings')}}" class="btn btn-danger">
                        <i class="icon-cogs"></i>
                    </a>
                        @endif
                </div>

                <div class="sidebar-shortcuts-mini" id="sidebar-shortcuts-mini">
                    <span class="btn btn-success"></span>

                    <span class="btn btn-info"></span>

                    <span class="btn btn-warning"></span>

                    <span class="btn btn-danger"></span>
                </div>
            </div><!-- #sidebar-shortcuts -->

            <ul class="nav nav-list">
                <li class="{{request()->getPathInfo()=='/admin/index'?'active':''}}">
                    <a href="{{url('admin/index')}}">
                        <i class="icon-dashboard"></i>
                        <span class="menu-text"> 控制台</span>
                    </a>
                </li>
                @if(empty(Session::get('admin')['is_author']))
                <li class="{{(in_array(request()->getPathInfo(),['/admin/category/3','/admin/videolist/1','/admin/videolist/0','/admin/addvideo']) || (bool)strpos(request()->getPathInfo(),'editvideo'))?'active open':''}}">
                    <a href="#" class="dropdown-toggle">
                        <i class="icon-film"></i>
                        <span class="menu-text"> 视频管理 </span>
                        <b class="arrow icon-angle-down"></b>
                    </a>

                    <ul class="submenu">
                        <li class="{{request()->getPathInfo()=='/admin/category/3'?'active':''}}">
                            <a href="{{url('admin/category/3')}}">
                                <i class="icon-double-angle-right"></i>
                                视频分类
                            </a>
                        </li>

                        <li class="{{request()->getPathInfo()=='/admin/videolist/1'?'active':''}}">
                            <a href="{{url('admin/videolist/1')}}">
                                <i class="icon-double-angle-right"></i>
                                视频列表<span class="badge badge-primary ">{{\App\Http\Model\Video::where(['status'=>1,'user_id'=>Session::get('admin')['id']])->count()}}</span>
                            </a>
                        </li>

                        <li class="{{request()->getPathInfo()=='/admin/addvideo'?'active':''}}">
                            <a href="{{url('admin/addvideo')}}">
                                <i class="icon-double-angle-right"></i>
                                添加视频
                            </a>
                        </li>

                        <li class="{{request()->getPathInfo()=='/admin/videolist/0'?'active':''}}">
                            <a href="{{url('admin/videolist/0')}}">
                                <i class="icon-double-angle-right"></i>
                                视频回收站<span class="badge badge-danger ">{{\App\Http\Model\Video::where(['status'=>0,'user_id'=>Session::get('admin')['id']])->count()}}</span>
                            </a>
                        </li>
                    </ul>
                </li>
                @endif
                @if(empty(Session::get('admin')['is_author']) || Session::get('admin')['role']==5 || Session::get('admin')['role']==2)
                <li class="{{(in_array(request()->getPathInfo(),['/admin/category/1','/admin/addarticle','/admin/artilelist/0','/admin/artilelist/1']) || (bool)strpos(request()->getPathInfo(),'editarticle'))?'active open':''}}">
                    <a href="#" class="dropdown-toggle">
                        <i class="icon-list"></i>
                        <span class="menu-text"> 文章管理 </span>

                        <b class="arrow icon-angle-down"></b>
                    </a>
                    <ul class="submenu">
                        @if(empty(Session::get('admin')['is_author']))
                        <li  class="{{request()->getPathInfo()=='/admin/category/1'?'active':''}}">
                            <a href="{{url('admin/category/1')}}">
                                <i class="icon-double-angle-right"></i>
                                文章分类
                            </a>
                        </li>
                        @endif

                        <li class="{{request()->getPathInfo()=='/admin/artilelist/1'?'active':''}}">
                            <a href="{{url('admin/artilelist/1')}}">
                                <i class="icon-double-angle-right"></i>
                                文章列表
                                <span class="badge badge-primary ">
                                    @if(!empty(Session::get('admin')['is_author']))
                                        {{\App\Http\Model\Article::where(['status'=>1,'user_id'=>Session::get('admin')['id']])->count()}}
                                    @else
                                        {{\App\Http\Model\Article::where(['status'=>1])->count()}}
                                    @endif
                                </span>
                            </a>
                        </li>

                        <li class="{{request()->getPathInfo()=='/admin/addarticle'?'active':''}}">
                            <a href="{{url('admin/addarticle')}}">
                                <i class="icon-double-angle-right"></i>
                                添加文章
                            </a>
                        </li>

                        <li class="{{request()->getPathInfo()=='/admin/artilelist/0'?'active':''}}">
                            <a href="{{url('admin/artilelist/0')}}">
                                <i class="icon-double-angle-right"></i>
                                文章回收站
                                <span class="badge badge-danger ">@if(!empty(Session::get('admin')['is_author']))
                                        {{\App\Http\Model\Article::where(['status'=>0,'user_id'=>Session::get('admin')['id']])->count()}}
                                    @else
                                        {{\App\Http\Model\Article::where(['status'=>0])->count()}}
                                    @endif
                                </span>
                            </a>
                        </li>
                    </ul>
                </li>
                @endif
                @if(empty(Session::get('admin')['is_author']) || Session::get('admin')['role']==5 || Session::get('admin')['role']==3)
                <li class="{{(in_array(request()->getPathInfo(),['/admin/category/2','/admin/addimg','/admin/imglist/1','/admin/imglist/0']) || (bool)strpos(request()->getPathInfo(),'editimg'))?'active open':''}}">
                    <a href="#" class="dropdown-toggle">
                        <i class="icon-picture"></i>
                        <span class="menu-text"> 图片管理 </span>

                        <b class="arrow icon-angle-down"></b>
                    </a>

                    <ul class="submenu">
                        @if(empty(Session::get('admin')['is_author']))
                        <li class="{{request()->getPathInfo()=='/admin/category/2'?'active':''}}">
                            <a href="{{url('admin/category/2')}}">
                                <i class="icon-double-angle-right"></i>
                                图片分类
                            </a>
                        </li>
                        @endif
                        <li class="{{request()->getPathInfo()=='/admin/imglist/1'?'active':''}}">
                            <a href="{{url('admin/imglist/1')}}">
                                <i class="icon-double-angle-right"></i>
                                图片列表
                                <span class="badge badge-primary ">
                                @if(!empty(Session::get('admin')['is_author']))
                                        {{\App\Http\Model\Images::where(['status'=>1,'user_id'=>Session::get('admin')['id']])->count()}}
                                    @else
                                        {{\App\Http\Model\Images::where(['status'=>1])->count()}}
                                    @endif
                                </span>
                            </a>
                        </li>
                        <li class="{{request()->getPathInfo()=='/admin/addimg'?'active':''}}">
                            <a href="{{url('admin/addimg')}}">
                                <i class="icon-double-angle-right"></i>
                                添加图片
                            </a>
                        </li>

                        <li class="{{request()->getPathInfo()=='/admin/imglist/0'?'active':''}}">
                            <a href="{{url('admin/imglist/0')}}">
                                <i class="icon-double-angle-right"></i>
                                图片回收站
                                <span class="badge badge-danger ">
                                    @if(!empty(Session::get('admin')['is_author']))
                                    {{\App\Http\Model\Images::where(['status'=>0,'user_id'=>Session::get('admin')['id']])->count()}}
                                        @else
                                        {{\App\Http\Model\Images::where(['status'=>0])->count()}}
                                    @endif
                                </span>
                            </a>
                        </li>
                    </ul>
                </li>
                @endif
                @if(empty(Session::get('admin')['is_author']))
                <li class="{{in_array(request()->getPathInfo(),['/admin/userlist','/admin/authorlist'])?'active open':''}}">
                    <a href="#" class="dropdown-toggle">
                        <i class="icon-user"></i>
                        <span class="menu-text"> 用户管理 </span>
                        <b class="arrow icon-angle-down"></b>
                    </a>

                    <ul class="submenu">
                        <li class="{{request()->getPathInfo()=="/admin/userlist"?'active':''}}">
                            <a href="{{url('admin/userlist')}}">
                                <span class="menu-text">普通用户管理 </span>
                            </a>
                        </li>

                        <li class="{{request()->getPathInfo()=="/admin/authorlist"?'active':''}}">
                            <a href="{{url('admin/authorlist')}}">
                                <span class="menu-text">作者管理 </span>
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="{{request()->getPathInfo()=="/admin/inbox"?'active':''}}">
                    <a href="{{url('admin/inbox')}}">
                        <i class="icon-inbox"></i>
                        <span class="menu-text"> 收件箱 </span>
                    </a>
                </li>
                <li>
                    <a href="{{url('admin/notice')}}">
                        <i class="icon-tasks"></i>
                        <span class="menu-text"> 公告管理 </span>
                    </a>
                </li>
                <li class="{{request()->getPathInfo()=="/admin/settings"?'active':''}}">
                    <a href="{{url('admin/settings')}}">
                        <i class="icon-cogs"></i>
                        <span class="menu-text"> 网站设置 </span>
                    </a>
                </li>
                <li>
                    <a href="javascript:;" onclick="db_back()">
                        <i class="icon-tasks"></i>
                        <span class="menu-text"> 备份数据库 </span>
                    </a>
                </li>
                @endif
            </ul><!-- /.nav-list -->

            <div class="sidebar-collapse" id="sidebar-collapse">
                <i class="icon-double-angle-left" data-icon1="icon-double-angle-left" data-icon2="icon-double-angle-right"></i>
            </div>

            <script type="text/javascript">
                try{ace.settings.check('sidebar' , 'collapsed')}catch(e){}
            </script>
        </div>

        @yield('content')
        <div class="ace-settings-container" id="ace-settings-container">
            <div class="btn btn-app btn-xs btn-warning ace-settings-btn" id="ace-settings-btn">
                <i class="icon-cog bigger-150"></i>
            </div>

            <div class="ace-settings-box" id="ace-settings-box">
                <div>
                    <div class="pull-left">
                        <select id="skin-colorpicker" class="hide">
                            <option data-skin="default" value="#438EB9">#438EB9</option>
                            <option data-skin="skin-1" value="#222A2D">#222A2D</option>
                            <option data-skin="skin-2" value="#C6487E">#C6487E</option>
                            <option data-skin="skin-3" value="#D0D0D0">#D0D0D0</option>
                        </select>
                    </div>
                    <span>&nbsp; 选择皮肤</span>
                </div>

                <div>
                    <input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-navbar" />
                    <label class="lbl" for="ace-settings-navbar"> 固定导航条</label>
                </div>

                <div>
                    <input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-sidebar" />
                    <label class="lbl" for="ace-settings-sidebar"> 固定滑动条</label>
                </div>

                <div>
                    <input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-breadcrumbs" />
                    <label class="lbl" for="ace-settings-breadcrumbs">固定面包屑</label>
                </div>

                <div>
                    <input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-rtl" />
                    <label class="lbl" for="ace-settings-rtl">切换到左边</label>
                </div>

                <div>
                    <input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-add-container" />
                    <label class="lbl" for="ace-settings-add-container">
                        切换窄屏
                        <b></b>
                    </label>
                </div>
            </div>
        </div><!-- /#ace-settings-container -->
    </div><!-- /.main-container-inner -->

    <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
        <i class="icon-double-angle-up icon-only bigger-110"></i>
    </a>
</div><!-- /.main-container -->

@yield('javascript')
<script>
    function db_back(){
        layer.confirm('你确定要备份吗？',{
            btn:['确定','取消']
        },function(){
            $.post('{{url('admin/database')}}',{'_token':'{{csrf_token()}}'},function(data){
                if(data.status==1){
                    layer.msg(data.msg,{icon:6});
                }else{
                    layer.msg(data.msg,{icon:5});
                }
            });
        },function(){

        });
    }
</script>
</body>
</html>

